package com.breezelin.freshmarket.entities.data;

/**
 * Created by Breeze Lin
 * 2016/5/15 14:30
 * breezesummerlin@163.com
 */

import com.breezelin.freshmarket.entities.JsonStruct;

import org.json.JSONObject;

/**
 * 商品规格
 */
public class Spec implements JsonStruct {

	/*
	{
        "CommodityId": "69664ad1-6563-462b-b688-1058abdcce55",
        "CommodityCode": "12061",
        "CommodityName": "云南夏黑葡萄1kg",
        "Spec": "1kg/组"
      }
	 */

	/**
	 * 货物id
	 */
	private String commodityId;
	/**
	 * 货物代码
	 */
	private String commodityCode;
	/**
	 * 货物名
	 */
	private String commodityName;
	/**
	 * 规格
	 */
	private String spec;

	public Spec() {
	}

	public Spec(JSONObject jsonObject) {
		fromJson(jsonObject);
	}

	public String getCommodityId() {
		return commodityId;
	}

	public String getCommodityCode() {
		return commodityCode;
	}

	public String getCommodityName() {
		return commodityName;
	}

	public String getSpec() {
		return spec;
	}

	@Override
	public void fromJson(JSONObject jsonObject) {
		commodityId = jsonObject.optString("CommodityId");
		commodityCode = jsonObject.optString("CommodityCode");
		commodityName = jsonObject.optString("CommodityName");
		spec = jsonObject.optString("Spec");
	}

	@Override
	public JSONObject toJson() {
		return new JSONObject();
	}
}
